import Vue from 'vue'
import App from 'preview/App'
import VueCookie from 'vue-cookie'            // api: https://github.com/alfhen/vue-cookie
import Element from 'element-ui'                         // api: https://github.com/ElemeFE/element
import '@/icons'                              // api: http://www.iconfont.cn/
import '@/element-ui-theme'
import '@/assets/scss/index.scss'
import cloneDeep from 'lodash/cloneDeep'
import httpRequest from '@/utils/comm-request' // api: https://github.com/axios/axios
// 动画
import animated from 'animate.css'
import template from 'preview/template/index'
// moment
import moment from 'moment-timezone'
import 'moment/locale/zh-cn'

import VueAwesomeSwiper from 'vue-awesome-swiper'
import VideoPlayer from '@/components/video-player'
import PdfViewr from '@/components/pdf-viewer'
import modal from '@/components/modal'
import scrollText from '@/components/scroll-text'

import 'swiper/dist/css/swiper.css'

// 路由
import router from 'preview/router'
// store
import store from 'preview/store'

template.install(Vue)
scrollText.install(Vue)

Vue.use(modal)
Vue.use(animated)

Vue.use(Element)
Vue.use(VueCookie)
Vue.use(VueAwesomeSwiper)
VideoPlayer.install(Vue)
PdfViewr.install(Vue)

Vue.prototype.$http = httpRequest // ajax请求方法

moment.locale('zh-cn')
Vue.prototype.$moment = moment

// 保存整站vuex本地储存初始状态
window.SITE_CONFIG['storeState_preview'] = cloneDeep(store.state)

// event bus
Vue.prototype.$EventBus = new Vue()
/* eslint-disable no-new */
new Vue({
  el: '#root',
  template: '<App/>',
  router,
  store,
  components: { App }
})
